﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using VNet.VisiSuite.Controls;
using VNet.VisiSuite.VisiBoard.ViewModels;
using VNet.VisiSuite.VisiBoard.Views;

namespace VNet.VisiSuite.VisiBoard.Controls
{
    public partial class VisiDialog : UserControl
    {
        public delegate void CloseCallback(VisiDialog dlg, object data);

        public EventHandler InputKeyBoardClick;

        #region Fields
        CloseCallback _callback;
        object _data;
        #endregion

        protected VisiDialog()
        {
        }

        public bool Cancelled { get; set; }

        public void RaiseInputKeyboardClick(EventArgs args =null)
        {
            if (InputKeyBoardClick != null)
            {
                InputKeyBoardClick(this, args);
            }
        }

        public void setOnClose(CloseCallback callback, object data)
        {
            _callback = callback;
            _data = data;
        }

        public virtual void close(bool process_calback = true)
        {
            InputKeyBoardClick = null;
            if (process_calback && _callback != null)
                _callback(this, _data);
            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
        }

        virtual public void refresh()
        {

        }

        #region Events Handler
        public virtual void onKeyDown(KeyEventArgs e)
        {
            // Do nothing here
        }
        #endregion

    }
}